/**
 * @date 2005-12-26 18:49:04
 *
 */
package org.nanhill.commons.lang;

/**
 * @author alin
 * 
 */
public class Timer {
	private long startTime;

	public Timer() {
		this.reset();
	}

	public void reset() {
		this.startTime = System.currentTimeMillis();
	}

	public long getPeriod() {
		return System.currentTimeMillis() - startTime;
	}

	public void println() {
		System.out.println("period: " + getPeriod());
	}

	public void printlnReset() {
		this.println();
		this.reset();
	}

	public void println(final String prefix) {
		System.out.println(prefix + getPeriod());
	}

	public void printlnReset(final String prefix) {
		this.println(prefix);
		this.reset();
	}

}
